# DarkCube X-8 Scramble Generator Class

import random
import logwriter

class scramble_version:
    def __init__(self):
        return 1.0
    
class gennota:
    def __init__(self):
        #Preparing var for algorithm
        log = logwriter.writer('scramble.py')
        log.status('Scramble Generator initialized')
        self.axis_x=['U','D']
        self.axis_y=['L','R']
        self.axis_z=['F','B']
        self.rot=['','\'','2']
        random.seed()
    def generate(self,intScLong = 25):
        strGened=''
        last2axis=-1
        lastaxis=-1
        lastplate=-1
        for i in range(intScLong):
            currentmove=random.randint(0,2)
            currentaxis=random.randint(0,2)
            currentplate=random.randint(0,1)
            while lastaxis==currentaxis and last2axis==currentaxis:
                currentaxis=random.randint(0,2)
            last2axis=lastaxis
            lastaxis=currentaxis
            if last2axis==lastaxis:
                currentplate=lastplate+1
                if currentplate==2:
                    currentplate=0
            lastplate=currentplate
            if lastaxis==0:
                dualplate=self.axis_x
            elif lastaxis==1:
                dualplate=self.axis_y
            elif lastaxis==2:
                dualplate=self.axis_z                
            strGened=strGened+dualplate[lastplate]+self.rot[currentmove]+' '
        return strGened

if __name__=='__main__':
    print ' Scramble Generator cannot run individually '
    scramble=gennota()
    print scramble.generate()